*******************************************************************************************
* Replication Material for "How Political Careers affect Prime-Ministerial Performance"   *
* Authors: Florian Grotz, Ferdinand Müller-Rommel, Jan Berz, Corinna Kroeber, Marko Kukec *
* Date: 07. January 2021                                                                  *
* Tested with Stata version 14.2                                                          *
******************************************************************************************* 

***********************************************************************************************************
* This do-file serves as short variable preparation call in the main do-file main_analysis_and_robustness *
***********************************************************************************************************


*************************************************************************
*** Some useful labelling for plots and regression tables beforehand  ***

label variable pmc_outsider_dummy `"PM outsider before entering office"'
label define outsider_dummy 0 "Insider" 1 "Outsider"
label values pmc_outsider_dummy outsider_dummy

label variable pmc_minister_dummy `"PM cabinet minister before entering office"'
label define minister_dummy 0 "Cabinet minister, No" 1 "Cabinet minister, yes"
label values pmc_minister_dummy minister_dummy

label define newpm_experience_leg 1 "MP, no" 2 "MP, yes" , replace 
label define newpmc_partyhead_pre 1 "Party head, no" 2 "Party head, yes" , replace

label variable pmc_partyhead_pre_duration `"Time PM served as party head prior to office (in years)"'

label variable cab_idrange_expert `"Ideological range between parties"'


*************************************************
** Standardising of non-dichotomous indicators **

/* dividing by 2 SD makes it directly comparable to dichotomous vars */


foreach var in pm_power_cabinet  pm_power_legislative pres_power_ab ///
cab_idrange_expert pmc_minister_duration ///
pm_experience_leg_duration pmc_prior_pm_exp pm_power_overall ///
pmc_years_since_election pmc_gdpchange_y1 pmc_unemp_y1 prespow1{

egen `var'_sd = std(`var') , std(2)

}

* The source dataset assigns missings to PM without party head experience to allow identification of
* PM who became party heads prior to their investiture but held the office for less than a years
* In order to appropriately include all cases into the duration models these missings are filled here
gen pmc_partyhead_pre_duration_graph = pmc_partyhead_pre_duration
replace pmc_partyhead_pre_duration = 0 if pmc_partyhead_pre_duration==. 

egen pmc_partyhead_pre_duration_sd = std(pmc_partyhead_pre_duration) , std(2)




label var pm_power_cabinet_sd "PM cabinet powers"
label var pm_power_legislative_sd "PM legislative powers" 
label var pres_power_ab_sd "Presidential power"
label var cab_idrange_expert_sd "Ideological range between two most extreme cabinet parties (expert)"
label var pmc_gdpchange_y1_sd "GDP change"
label var pmc_unemp_y1_sd "Unemployment rate"
label var pmc_minister_duration_sd "Duration of PM overall experience as minister (in years)"
label var pm_experience_leg_duration_sd "Duration PM served as member of parliament at the national level in years"
label var pmc_prior_pm_exp_sd "Experience from prior duration as PM"
label var pm_power_overall_sd "PM overall powers"
